package com.liyuan.help_e.help_e;

import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;

public class test {
    public static void main(String[] args) throws IOException {
        URL url = new URL("https://www.gdufs.edu.cn/__local/A/AB/D4/EC10A41F891C3467D094CEA752E_8A7F8121_FE71.jpg");
        HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
        httpURLConnection.connect();
        DataInputStream dataInputStream = new DataInputStream(new BufferedInputStream(httpURLConnection.getInputStream()));
        String path = System.getProperty("user.dir")+"\\target\\classes\\static\\images\\img\\";
        String file = path+"test.jpg";
        DataOutputStream dataOutputStream = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(new File(file))));
        int v;
        while ((v=dataInputStream.read())!=-1){
            dataOutputStream.write(v);
        }
        dataInputStream.close();
        dataOutputStream.close();


    }
}
